package xyz.zhno.prototype;

import java.util.Date;

/**
 * 原型
 * @author zh_o
 * @date 2020-11-15
 */
public class Video implements Cloneable {

    private String title;

    private Date createTime;

    /**
     * 重写 Clone 方法
     */
    @Override
    protected Object clone() throws CloneNotSupportedException {
        Video clone = (Video) super.clone();
        Date date = (Date) clone.getCreateTime().clone();
        clone.setCreateTime(date);
        return clone;
    }

    public Video() {}

    public Video(String title, Date createTime) {
        this.title = title;
        this.createTime = createTime;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    @Override
    public String toString() {
        return "Video{" +
                "title='" + title + '\'' +
                ", createTime=" + createTime +
                '}';
    }

}
